<!DOCTYPE html>
<html lang="en">
	<head>
		<title>购物车</title>
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	</head>
	<body>
		
		<ul>
			<li><a href="javascript:addItem(1,1);">商品1</a></li>
			<li><a href="javascript:addItem(2,1);">商品2</a></li>
			<li><a href="javascript:addItem(3,1);">商品3</a></li>
			<li><a href="javascript:addItem(4,1);">商品4</a></li>
		</ul>
		
		<a href="view">前往购物车</a>
	</body>
</html>
<script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.js"></script>
<script type="text/javascript">
<!--

function addItem(id,num){
	$.post("../cart/addCartItem", { id: id, num:num },
	   function(data){
	    eval('var data = ' + data + ';');
		if(data.success) {
			alert("success");
		}
	   },"text");
}

//-->
</script>
